<?php
namespace app\before\validate;

use think\Validate;

class Upgrade extends Validate
{
    protected $rule = [
        'user_id' => 'require|number',
        'grade_type' => 'require',
        'price' => 'require|number',
        'pay_type' => 'require',
        'order_no' => 'require',
        'tran_no' => 'require',
        'pay_time' => 'require|number',
    ];
    protected $message = [
        'user_id.require' => '购买会员为必填项',
        'user_id.number' => '购买会员需为数字',
        'grade_type.require' => '会员类型为必填项',
        'price.require' => '支付金额为必填项',
        'price.number' => '支付金额需为数字',
        'pay_type.require' => '支付方式 0：余额  1：微信  2：支付宝为必填项',
        'order_no.require' => '订单编号为必填项',
        'tran_no.require' => '交易号为必填项',
        'pay_time.require' => '支付时间为必填项',
        'pay_time.number' => '支付时间需为数字',
    ];
    protected $scene = [
        'edit' => [
            'user_id',
            'grade_type',
            'price',
            'pay_type',
            'order_no',
            'tran_no',
            'pay_time',
        ],
    ];
}
